﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.Infrastructure;

namespace ERPStore.NewsLetters.Repositories
{
    internal class DbContextFactory : CloudSoft.Repositories.IDbContextFactory<NewsLettersDbContext>
    {
		public DbContextFactory()
		{

		}

        public NewsLettersDbContext GetDbContext()
        {
            var nlCs = System.Configuration.ConfigurationManager.ConnectionStrings["ERPStoreConnectionString"].ConnectionString;
            var dbContext = new NewsLettersDbContext(nlCs);
            return dbContext;
        }

        public IObjectContextAdapter GetObjectContextAdapter()
        {
            var dbContext = GetDbContext();
            return (IObjectContextAdapter)dbContext;
        }

		public void Dispose()
		{
		}
    }
}
